﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebShop.DataService;

namespace WebShop.Models
{
    /// <summary>
    /// History utem model
    /// </summary>
    public class HistoryItemModel : BaseModel
    {
        /// <summary>
        /// Order info
        /// </summary>
        public OrderFull Order { get; set; }

        /// <summary>
        /// Total price of cart
        /// </summary>
        public decimal TotalPrice
        {
            get
            {
                decimal result = 0;

                foreach (OrderPosition item in Order.Composition)
                {
                    result += item.Cost * item.Count;
                }

                return result;
            }
        }
    }
}